package com.hexu.event.util;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class WebUtil {

    public static void show(boolean flag, HttpServletRequest request, HttpServletResponse response,String success,
                     String error, String addressSuccess,String addressError) throws ServletException, IOException {
        if(flag){
            request.setAttribute("success",success);
            request.setAttribute("address",addressSuccess);
            request.getRequestDispatcher("/success.jsp").forward(request, response);
        }else {
            request.setAttribute("error",error);
            request.setAttribute("address",addressError);
            request.getRequestDispatcher("/error.jsp").forward(request, response);
        }

    }
}
